package com.tmt.im.jpa.entity;

import com.tmt.data.jpa.entity.TmtBaseEntity;
import com.tmt.data.jpa.entity.TmtBaseEntityId;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import java.io.Serial;
import java.math.BigDecimal;

/**
 * 用户钱包
 *
 * @Description TODO
 * @Author wuyi
 * @Date 2024/8/6 21:53
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "wallet")
@Tag(name = "wallet", description = "用户钱包表")
public class Wallet extends TmtBaseEntityId {

    @Serial
    private static final long serialVersionUID = 7847222083230304010L;

    /**
     * 钱包中的当前余额, 单位：分。
     */
    private Long balance;

    /**
     * 钱包的支付密码
     */
    @Column(length = 100)
    private String password;

    /**
     * 绑定的支付宝账号
     */
    private String aliPay;

    /**
     * 绑定的微信账号
     */
    private String weiXin;

    /**
     * 钱包的拥有者
     */
    @OneToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false)
    private IMUser owner;

}
